package com.dtjd.playcoinmonkey.adapter;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import com.dtjd.playcoinmonkey.R;
import com.dtjd.playcoinmonkey.bean.NoticeBean;
import com.dtjd.playcoinmonkey.databinding.ItemNoticeBinding;

import java.util.List;

public class NoticeAdapter extends ArrayAdapter<NoticeBean> {
    private final Activity context;
    public NoticeAdapter(Activity context, List<NoticeBean> objects){
        super(context, R.layout.item_notice,objects);
        this.context=context;
    }
    @SuppressLint("SetTextI18n")
    @Override
    public View getView(int position, View convertView, ViewGroup parent){
        NoticeBean bean = getItem(position);
        @SuppressLint("ViewHolder") ItemNoticeBinding itemNoticeBinding= ItemNoticeBinding.inflate(LayoutInflater.from(context));
        itemNoticeBinding.itemNoticeTime.setText(bean.time);
        itemNoticeBinding.itemNoticeContent.setText(bean.content);
        return itemNoticeBinding.getRoot();
    }
}
